package com.weijin.exception;

import com.weijin.vo.RestResultVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @Author WeiJin
 * @Version 1.0
 * @Date 2025/3/18 15:24
 */
@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {

    @ExceptionHandler(RuntimeException.class)
    public RestResultVo<String> handlerRuntimeException(RuntimeException e) {
        log.error("[系统异常信息]：{}", e.getMessage());
        RestResultVo<String> resultVo = new RestResultVo<>();
        resultVo.setStatus(-1);
        resultVo.setMessage(e.getMessage());
        return resultVo;
    }

}
